#include "editPlotWindow.h"

editPlotWindow::editPlotWindow(QWidget *parent)
{

    layout = new QGridLayout();
    okButton = new QPushButton("Ok");
    cancelButton = new QPushButton("Cancel");

    xAxis = new QLabel("x-axis limits: ");
    yAxis = new QLabel("y-axis limits: ");

    xLimitMin = new QPlainTextEdit();
    xLimitMax = new QPlainTextEdit();
    yLimitMin = new QPlainTextEdit();
    yLimitMax = new QPlainTextEdit();
    xLimitMin->setFixedSize(100,30);
    xLimitMax->setFixedSize(100,30);
    yLimitMin->setFixedSize(100,30);
    yLimitMax->setFixedSize(100,30);

    to1 = new QLabel("to");
    to2 = new QLabel("to");

    layout->addWidget(xAxis,0,0,1,1,0);
    layout->addWidget(yAxis,1,0,1,1,0);
    layout->addWidget(xLimitMin, 0,1,1,1,0);
    layout->addWidget(to1,0,2,1,1,0);
    layout->addWidget(xLimitMax, 0,3,1,1,0);
    layout->addWidget(yLimitMin, 1,1,1,1,0);
    layout->addWidget(to2,1,2,1,1,0);
    layout->addWidget(yLimitMax, 1,3,1,1,0);
    layout->addWidget(okButton,2,0,1,1,0);
    layout->addWidget(cancelButton,2,1,1,1,0);
    this->setLayout(layout);

    //this->setWindowTitle("Plot options");

    connect(okButton, SIGNAL(clicked()), this, SLOT(ok()));
    connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancel()));

}

editPlotWindow::~editPlotWindow()
{

}

void editPlotWindow::ok()
{
    // update plot parameters
    emit updatePlotAxis();
    this->hide();
}

void editPlotWindow::cancel()
{

    this->hide();

}
